package com.yequan.work;

import org.apache.commons.lang3.StringUtils;

import java.math.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author yequan
 * @date 2021/03/22 10:45
 **/
public class IntegerDemo {


    public static void main(String[] args) {
//        big();
//        compare();
//        testChangeCarSeatNum();
//        lastNum();
//        box();
//        equals();
//        num();
        parseNum();
    }

    public static void parseNum() {
        String nv = null;
        System.out.println(StringUtils.isBlank(nv) ? null : Integer.parseInt(nv));
    }

    public static void num() {
        Integer num = null;
        num(num);
    }

    private static void num(int num) {
        System.out.println(num);
    }

    public static void equals() {
        Integer type = null;
        System.out.println((Objects.nonNull(type) && type == 48));
    }

    public static void box() {
        Integer num = null;
        int a = num;
        System.out.println(a);
    }

    public static void lastNum() {
        Integer num = 150073798;
        int last = num % 10;
        System.out.println(last);
    }

    private static void big() {
        BigDecimal operateSubsidy = new BigDecimal(1150).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
        if (operateSubsidy.compareTo(BigDecimal.ZERO) < 1) {
            System.out.println("jjjjjjj");
            return;
        } else {
            System.out.println("kkkkkkk");
        }
        Integer a = 4;
        Integer b = 4;
        System.out.println(a.equals(b));
    }

    public static void compare() {
        Integer a = 99;
        Integer b = 10;
        System.out.println(a.compareTo(b));
    }

    public static void testChangeCarSeatNum() {
        int num = 2;
        num = changeCarSeatNum(2);
        System.out.println(num);
    }

    public static int changeCarSeatNum(int carSeatNum) {
        int maxSeatNum = 0;
        if (carSeatNum > 5) {
            maxSeatNum = 6;
        } else {
            maxSeatNum = 4;
        }
        return maxSeatNum;
    }

}
